<script type="text/javascript" src="<?=base_url()?>resource/js/layer/layer.js"></script>
<script type="text/javascript" src="<?=base_url()?>resource/js/echarts.js"></script>
<script type="text/javascript" src="<?=base_url()?>resource/plugins/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
    $(function(){
        $("select[data-edit-select]").filterSelect();
    });
</script>

<!--菜单 start-->
<?php $this->load->view('defaults/common/left');?>
<!--菜单 end-->
<div id="content">
    <div class="page-header">
        <div class="container-fluid">
          <h1><?=lang('menu_maintain_report')?></h1>
          <?=$this->breadcrumb->generateHTML();?>
        </div>
    </div>
    <div class="container-fluid">
        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title"><i class="fa fa-bar-chart-o"></i>综合处理量</h3>
          </div>
          <div class="panel-body">
            <div class="well" style="padding:0 19px;">
              <div class="row">
                <form action="<?=blang_url('maintainReport/maintainReport/statusStatement/')?>" method="post" enctype="multipart/form-data" name="searchform" >
                    <div class="col-sm-3">
                        <div class="form-group">
                            <div class="form-group">
                                <label class="control-label">电商</label>
                                <select class="form-control" name="merchant_num" data-edit-select="1">
                                <option value="">-全部-</option>
                                <?php foreach($mCline as $row){?>
                                    <option value="<?=$row['id']?>"><?=$row['name']?></option>
                                <?php }?>
                            </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-3">
                        <div class="form-group">
                            <div class="form-group">
                                <label class="control-label">品牌商</label>
                                <select class="form-control" name="brandCustomerNum" data-edit-select="1" style="width: 400px;">
                                    <option value="">-全部-</option>
                                    <?php foreach($bCline as $row){?>
                                        <option value="<?=$row['id']?>"><?=$row['name']?></option>
                                    <?php }?>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-3">
                        <div class="form-group">
                            <div class="form-group">
                                <label class="control-label"><?=lang('order_kssj')?></label>
                                <input type="text" name="startTime" value="" onfocus="WdatePicker({lang:'en'})" class="form-control Wdate" />
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-3">
                        <div class="form-group">
                            <div class="form-group">
                                <label class="control-label"><?=lang('order_jssj')?></label>
                                <input type="text" name="endTime" value="" onfocus="WdatePicker({lang:'en'})" class="form-control Wdate" />
                            </div>
                            <input class="btn btn-primary pull-right" style="margin-bottom: 19px;" type="submit" name="searchSubmit" value="<?=lang('file_cx')?>" />
                        </div>
                    </div>
                </form>
                
              </div>
            </div>
            <div class="table-responsive">
                <div id="main" style='height:600px;width: 1200px;'></div>
                <script>
                    var myChart = echarts.init(document.getElementById('main'));
                    var datas = JSON.parse('<?=$statusData?>');
                    option = {
                        baseOption: {
                            timeline: {
                                // y: 0,
                                axisType: 'category',
                                // realtime: false,
                                // loop: false,
                                // currentIndex: 2,
                                playInterval: 1000,
                                // controlStyle: {
                                //     position: 'left'
                                // },
                                data: datas['time']
                            },
                            title: {
                                subtext: '数据来自丹宏昊天网络科技有限公司'
                            },
                            tooltip: {
                                trigger: 'item',
                                formatter: "{a} <br/>{b} : {c} ({d}%)"
                            },
                            legend: {
                                x: 'right',
                                data: ['订单总量', '待接收', '维修中', '维修完成']
                            },
                            calculable: true,
                            grid: {
                                top: 80,
                                bottom: 100,
                                width:600
                            },
                            xAxis: [{
                                'type': 'category',
                                'axisLabel': {
                                    'interval': 0
                                },
                                'data': [
                                    '西班牙', '德国', '俄罗斯', '英国','美国','深圳'
                                ],
                                splitLine: {
                                    show: false
                                }
                            }],
                            yAxis: [{
                                type: 'value',
                                axisLabel: {
                                    formatter: '{value}'
                                }
                            }],
                            series: [{
                                name: '订单总量',
                                type: 'bar'
                            }, {
                                name: '待接收',
                                type: 'bar'
                            }, {
                                name: '维修中',
                                type: 'bar'
                            }, {
                                name: '维修完成',
                                type: 'bar'
                            },{
                                name: '状况占比',
                                type: 'pie',
                                center: ['75%', '35%'],
                                radius: '28%'
                            }]
                        },
                        options: [
                            <?php foreach($statusTime as $key=>$val){?>
                            {
                            title: {
                                text: '<?=$val?>全球订单状况'
                            },
                            series: [{
                                data: datas['data']['<?=$val?>']['total']
                            },{
                                data: datas['data']['<?=$val?>']['waiting']
                            },{
                                data: datas['data']['<?=$val?>']['repairIng']
                            },{
                                data: datas['data']['<?=$val?>']['repairOk']
                            }, {
                                data: [{
                                    name: '待接收',
                                    value: datas['data']['<?=$val?>']['waitingTotal']
                                }, {
                                    name: '维修中',
                                    value: datas['data']['<?=$val?>']['repairIngTotal']
                                }, {
                                    name: '维修完成',
                                    value: datas['data']['<?=$val?>']['repairOkTotal']
                                }]
                            }]
                        },
                            <?Php }?>
                        ]
                    };
                    myChart.setOption(option);
                </script>
                
            </div>
          </div>
        </div>
    </div>

</div>